from abc import ABC, abstractmethod

from ai_core.audio_format.opus import OpusEncode


class Tts(ABC):

    def audio_file_to_opus(self,audio_path):
        """将语音文件转为opus数据返回"""
        opus = OpusEncode()
        opus_datas, duration = opus.audio_to_opus(audio_path)
        return opus_datas,duration

    @abstractmethod
    def text_to_opus_data(self, text):
        """将文本转为opus数据"""
        raise NotImplementedError()